package cn.sunshine.feign;

import cn.sunshine.domain.Product;
import cn.sunshine.domain.Result;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ProductFeginClientFallbackFactory implements FallbackFactory<ProductFeginClient> {


    @Override
    public ProductFeginClient create(Throwable throwable) {
        return new ProductFeginClient() {
            @Override
            public Result add(Product product) {
                throwable.printStackTrace();
                return Result.builder().success(false).message("false!!!").build();
            }
        };
    }
}
